{$header}
<tagLib name="html" />
<div id="main" class="main" >
<!-- 主体内容  -->
<div class="content" >

<!--  功能组区域  -->
<div class="btn-toolbar">
	<div class="btn-group">
		<button class="btn btn-primary" onclick="add()"> <i class="icon-plus icon-white"></i>
			新增
		</button>
		<button class="btn btn-primary" onclick="check()">
			<i class="icon-check icon-white"></i>
			审批
		</button>
		<button class="btn btn-primary" onclick="checkFail()">
			<i class="icon-remove icon-white"></i>
			审批不通过
		</button>

  <button class="btn btn-primary" onclick="charge()"><i class="icon-user icon-white"></i> 分配</button>
  <button class="btn btn-primary" onclick="tocheck()"><i class="icon-warning-sign icon-white"></i>待分配</button>
		<button class="btn btn-primary" onclick="foreverdel()"> <i class="icon-trash icon-white"></i>
			删除大订单
		</button>
		
	</div>
<!--
	<form class="search-form pull-right" method='post' action="__URL__">
		 {:modList('User',$_REQUEST['user_id'])}
		 <input type="submit" value="经办人" class="btn btn-primary">
</form> -->
	<form class="search-form pull-right" method='get' action="__URL__">
		<select name="time_type" class="span1"> 
			<option value="1" <eq name="_REQUEST.time_type" value="1">selected</eq> >交货期</option> 
			<option value="2" <eq name="_REQUEST.time_type" value="2">selected</eq> >创建时间</option> 
		</select>
		从<input type="text" class="span2"  name="start_time" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="<notempty name='_REQUEST.start_time'>{$_REQUEST.start_time}</notempty>">
		到<input type="text" class="span2" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" name="end_time" id="end_time" value="<notempty name='_REQUEST.end_time'>{$_REQUEST.end_time}</notempty>" >
		负责人{:modList( 'User',$_REQUEST['charge_man'],'span1','charge_man' )}
		订单{:configList(C('orderDetailStatus'),$_REQUEST['dstatus'],'dstatus')}
		收款状态
		{:configList(C('receiptStatus'),$_REQUEST['dreceipt_status'],'dreceipt_status')}
		<input type="text" class="search-query" name="customer" <notempty name='_REQUEST.customer'>
		<php>echo 'value="'.urldecode($_REQUEST['customer']).'"'</php>
		<else/>
		placeholder="输入客户名"
	</notempty> >
		<input type="text" class="search-query span4" name="keywords" <notempty name='_REQUEST.keywords'>
		<php>echo 'value="'.urldecode($_REQUEST['keywords']).'"'</php>
		<else/>
		placeholder="搜索产品英文名，销售单分号、PO或CAS "
	</notempty>
	>
	<input type="submit" class="btn btn-primary" value="搜索">
	</form>
	
</div>
<!-- 功能组区域结束 -->
<php>
    function detail($id){
    echo ('<a href="__APP__/Order_detail/edit/id/'.$id.'">小订单详情</a>');
    }
    function toOd($time){
    echo toDate($time,'Y-m-d');
}
//实际 上获取对应发货的详情
   function getShippingLink($oid){
   	$shipping_id = D('ShippingDetailOrderDetailView')->where('order_detail_id = '.$oid)->getField('shipping_id');
   	if($shipping_id)
   		return '<a href="__APP__/Document/edit/id/'. $shipping_id.'">发货详情</a>';
    else
        return ;
}

</php>
<!-- 列表显示区域  -->
<div class="list" >
<div id="result" class="result none"></div>
<div class="btn-toolbar">
  <div class="btn-group">
  	<a href="__URL__/index/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn"><i class="icon-flag"></i>我的订单</a>
	<a href="__URL__/index" class="btn"><i class="icon-ok"></i>全部订单</a>
	<a href="__URL__/index/dstatus/0" class="btn"><i class="icon-th-list"> </i>全部待确认</a>
		<a href="__URL__/index/status/1" class="btn"><i class="icon-check"></i>全部待审批</a>
		<a href="__URL__/index/status/1/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn"><i class="icon-check"></i>待审批</a>
		<a href="__URL__/index/status/-2" class="btn"><i class="icon-remove"></i>审批未通过</a>
        
        <!--order priority-->
		<a href="__URL__/index/priority/0/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn btn-warning"><i class="icon-question-sign"></i>普通</a>
		<a href="__URL__/index/priority/1/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn btn-warning"><i class="icon-ok-sign"></i>现货</a>
		<a href="__URL__/index/priority/2/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn btn-warning"><i class="icon-info-sign"></i>急单</a>
		<a href="__URL__/index/priority/3/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn btn-warning"><i class="icon-exclamation-sign"></i>催单</a>

		<?php $ods = C('orderDetailStatus'); ?>
	</div>
	<div class="btn-group">
		<foreach name="ods" item="vo">
			<a href="__URL__/index/dstatus/{$key}/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn"><i class="icon-th-list"> </i>{$vo}</a>
		</foreach>
	</div>
</div>
<html:list id="checkList" pk="id" style="table table-bordered table-striped" name="action" checkbox="true" action="true" datasource="list" show="id:编号|4%:edit,dmano:销售订单分号,po:PO号,customer_info:客户|8%,pid|getPfullName:产品|12%,pid|getCas:CAS,specification|getModelName=Specification:规格,number:数量,did|getMsgTip:备注,dshould_pay:应收款,dcost:成本单价,dreceipt_status|getConfigVal='receiptStatus':收款状态,dreal_pay:实收款,currency|getConfigVal=Currency:货币,delivery_date|toOd:要求交货期,priority|getConfigVal=Priority:优先级,did|getShippingLink:发货详情,dstatus|getConfigVal=orderDetailStatus:小状态,charge_man|getModelName=User:负责人,user_id|getModelName=User:经办人,dctime|toDate:创建时间,did|detail:detail_order" actionlist="edit:详情:id" />
</div>
<!--  分页显示区域 -->
<div class="page">{$page}</div>
<!-- 列表显示区域结束 -->
</div>
<!-- 主体内容结束 -->
</div>
<include file="Public:footer"/>
<script type="text/javascript">
	function check(id){
		var keyValue;
		if (id)
		{
			keyValue = id;
		}else {
			keyValue = getSelectCheckboxValues();
		}
		if (!keyValue)
		{
			alert('请选择要审批的订单！');
			return false;
		}
		location.href =  URL+"/check/id/"+keyValue;
	}
	

	function checkFail(id){
		var keyValue;
		if (id)
		{
			keyValue = id;
		}else {
			keyValue = getSelectCheckboxValues();
		}
		if (!keyValue)
		{
			alert('请选择要审批的订单！');
			return false;
		}
		location.href =  URL+"/checkFail/id/"+keyValue;
	}
function charge(id){
    var keyValue;
    if (id)
    {
      keyValue = id;
    }else {
      keyValue = getSelectCheckboxValues();
    }
    if (!keyValue)
    {
      alert('请选择订单！');
      return false;
    }
    location.href=URL+"/charge/id/"+keyValue;
  }
</script>
<load href="__PUBLIC__/Js/My97DatePicker/WdatePicker.js" />
